<extend name="Base/mob_common"/>
<block name="mob_header">
    <div data-am-widget="header" class="am-header am-header-default am-header-fixed">
        <script src="__JS__/forum.js"></script>
        <link rel="stylesheet" href="__CSS__/apps/forum.css"/>
        <div class="am-header-left am-header-nav">
            <a href="javascript:history.go(-1);"><span class="am-icon-chevron-left"></span></a>

        </div>
        <h1 class="am-header-title" id="pid">
            帖子详情
        </h1>

        <div class="am-header-right am-header-nav">

            <a href="#nav-link" class="">
                <i class="am-menu-toggle-icon am-icon-bars"></i>
            </a>
        </div>
    </div>
</block>
<block name="mob_body">
    <div class="post-container ">
        <div class="post-title" style="padding: 10px">
            <h3>{$forum.title}</h3>
        </div>
        <div class="post">

            <div class="post-box">

                <div class="am-cf info">
                    <div class="am-fl avatar" style="padding: 0px">
                        <img class="avatar-img" style="width: 24px;" src="{$forum.user.avatar128}">
                    </div>
                    <div class="nickname am-fl" style="padding: 0px;margin-left: 10px">
                        <a> {$forum.user.nickname}</a>
                        <a class="support" post_id="{$forum['id']}" user_id="{$forum['uid']}"
                           url="{:U('Mob/Forum/support')}">
                            <if condition="$forum['has_support'] eq 1">
                                <i class="am-icon-thumbs-up"></i>
                                <else/>
                                <i class="am-icon-thumbs-o-up"></i>
                            </if>
                            <span>{$forum.support}</span>
                        </a>

                    </div>
                    <div class="am-fr part">
                        楼主<br>
                        <php>if($forum['uid']==is_login()||is_administrator(is_login())){</php>
                        <div class="am-fr">
                            <a href="{:U('Mob/Forum/addpost',array('isedit'=>1,'postid'=>$forum['id']))}">编辑帖子</a>
                        </div>
                        <div class="delpost" url="{:U('Mob/Forum/delPost')}" post-id="{$forum.id}" index-url="{:U('mob/Forum/index')}">
                            <a  class="am-icon-trash">删除帖子</a>
                        </div>
                        <php>}</php>
                    </div>

                </div>
                <div class="time" style="font-size: 12px">
                    <span>{$forum.create_time|friendlyDate}</span>
                </div>
                <div class="content">
                    <p> {$forum.content}</p>
                </div>
            </div>
        </div>
        <div class="comment-item ">
            <volist name="postcomment" id="vl" key="k">
                <include file="_forumcomment"/>
            </volist>
        </div>
        <if condition="$pid['count'] eq 1">
            <div class="am-list-news-ft look-more">
                <a class="" id="getmoreforumcomment">查看更多...</a>
            </div>
        </if>
    </div>
    <div data-am-widget="navbar" class="am-navbar am-cf am-navbar-default "
         id="">
        <ul class="am-navbar-nav am-cf am-avg-sm-4" style="font-size: 13px">
            <li>
                <if condition="$isadd eq 0">
                    <a class="collection" post_id="{$forum.id}" add=1 url="{:U('Mob/forum/collection')}">
                        收藏
                    </a>
                </if>
                <if condition="$isadd eq 1">
                    <a class="collection" post_id="{$forum.id}" add=0 url="{:U('Mob/forum/collection')}">
                        取消收藏
                    </a>
                </if>
            </li>
            <li>
                <a class="reply_post" href="{:U('Mob/Forum/addcomment',array('id'=>$forum['id']))}">
                    回复
                </a>
            </li>
        </ul>
    </div>

    <script>
        nextpageforumcomment();
        delcomment();
        support();
        delpost();
        //查看更多帖子评论
        var forum_id = "{$forum['id']}";
        function nextpageforumcomment() {
            $('#getmoreforumcomment').unbind('click');
            $('#getmoreforumcomment').click(function () {
                $("#getmoreforumcomment").html("查看更多" + '&raquo;');
                $.post("{:U('Mob/Forum/addMoreForumComment')}", {page: page + 1, id: forum_id}, function (msg) {
                    if (msg.status) {
                        $(".comment-item").append(msg.html);
                        page++;
                        delcomment();
                    } else {
                        $("#getmoreforumcomment").html("全部加载完成！");
                        $(".look-more").delay(1000).hide(0);
                    }
                })
            });
        }
    </script>
</block>
